<?php 
namespace app\Admin\controller;
use think\Controller;
use app\admin\model\Users;
use app\admin\model\User_rank;
use app\admin\model\Feedback;
use app\admin\model\Payment;
use app\admin\model\User_account;
use app\admin\model\Member_grade;
class Member extends Base
{
	
	public function member_list(){
		$model=new Users();
		$data=$model->select();
		$listarea=$model->paginate($data);
		$page=$listarea->render();
		$this->assign("listarea",$listarea);
		$this->assign('page', $page);
		return $this->fetch();
	}

	public function member_add(){
		$model=new Users();
		$data=input("post.");
		$res=$model->add($data);
		if ($res) {
			$this->success('添加会员成功~~~', 'member/member_list');
		}
		return $this->fetch();
	}

	public function apply(){
		return $this->fetch();
	}

	public function add_apply(){
		$model=new Payment();
		$apply=$model->select();
		$this->assign("apply",$apply);
		return $this->fetch();
	}

	public function add_apply_do(){
		$model=new User_account();
		$data=input("post.");
		$res=$model->add($data);
		if ($res) {
			$this->success('添加充值和申请成功~~~', 'member/member_list');
		}
	}

	public function member_leav_message(){
		$member_leav_message=new Feedback();
		$member_leav_message=$member_leav_message->select();
		$this->assign("member_leav_message",$member_leav_message);
		return $this->fetch();
	}

	public function member_grade(){
		$member_grade=new User_rank();
		$grade=$member_grade->select();
		$this->assign("grade",$grade);
		return $this->fetch();
	}

	public function add_grade(){
		return $this->fetch();
	}

	public function feedback(){
		$feedback=new feedback();
		$grade=$feedback->select();
		$this->assign("feedback",$feedback);
		return $this->fetch();
	}

	public function member_add_data(){
		$data=input("post.");
		$model=new Users();
		$res=$model->add($data);
		if ($res) {
			$this->success('新增会员成功~~~', 'member/member_list');
		}
	}

	public function add_rank()
	{
		$data=input("post.");
		$model=new User_rank();
		$rs=$model->add_data($data);
		if($rs){
			$this->success('新增会员等级成功~~~', 'member/member_grade');
		}
	}

	public function fund_management(){
		return $this->fetch();
	}

	public function money_detail(){
		return $this->fetch();
	}

	public function adjust_member(){
		return $this->fetch();
	}

	public function member_edit(){
		$model=new Users();
		$user_id=$_GET["user_id"];
		$data=$model->find($user_id);
		$this->assign("data",$data);
		return $this->fetch();
	}
}
